using System.Linq.Expressions;
using CoreEx.Database.Query.Expressions;

namespace CoreEx.Database.Linq.Translators
{
    /// <summary>
    /// Represents a class that is capable of translating an <see cref="Expression"/>
    /// into a <see cref="DbExpression"/> instance.
    /// </summary>
    /// <typeparam name="TExpression">The type of <see cref="Expression"/> to translate.</typeparam>
    public interface IExpressionTranslator_generic<TExpression> where TExpression :Expression
    {
        /// <summary>
        /// Translates the <paramref name="expression"/> into a <see cref="DbExpression"/> instance.
        /// </summary>
        /// <param name="expression">The <see cref="Expression"/> to translate.</param>
        /// <returns><see cref="DbExpression"/></returns>
        DbExpression Translate(TExpression expression);

        /// <summary>
        /// Translates the <paramref name="methodCallExpression"/> into a <see cref="DbExpression"/> instance.
        /// </summary>
        /// <param name="methodCallExpression">The <see cref="MethodCallExpression"/> to translate</param>
        /// <param name="outerMappedProperty"></param>
        /// <returns>A <see cref="DbExpression"/> that represents a sub query.</returns>
        DbExpression TranslateAsSubQuery(MethodCallExpression methodCallExpression, MappedProperty outerMappedProperty);
    }
}